/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frm_JInterFrameQuanLyPhim.java
 *
 * Created on Aug 2, 2011, 5:52:07 PM
 */

package GUI;

import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;



/**
 *
 * @author HP
 */
public class frm_JInterFrameQuanLyPhong extends javax.swing.JInternalFrame {

    /** Creates new form frm_JInterFrameQuanLyPhim */
// <editor-fold defaultstate="collapsed" desc="1. Cac Thuoc Tinh">
//     ArrayList<NhaXuatBanPOJO> dsnxb=new ArrayList<NhaXuatBanPOJO>();
//    ArrayList<TheLoaiPOJO> dstheloai=new ArrayList<TheLoaiPOJO>();
//    TheLoaiDAO theloaidao=new TheLoaiDAO();
//    NhaXuatBanDAO nhaxbdao=new NhaXuatBanDAO();
//    SachDAO sachdao=new SachDAO();
//    ArrayList<SachPOJO> dssach=new ArrayList<SachPOJO>();
//    DefaultTableModel dftablemodel =new DefaultTableModel();//Doi tuong thao tac dong cot cua table
//   int stt=1;
// </editor-fold>
   /**
    * Ham Khoi Tao Cac Cot Cho jtblDSSach
    */
    private void InitColumTable()
    {
//        dftablemodel.addColumn("STT");
//        dftablemodel.addColumn("Ma Sach");
//        dftablemodel.addColumn("Ten Sach");
//        dftablemodel.addColumn("Gia Ban");
//        dftablemodel.addColumn("So Luong Ton");
//        this.jtblDSSach.setModel(dftablemodel);
    }
/**
 * Ham Khoi Tao cua Form (Khi run thi ham nay dc chay dau tien)
 */
    public frm_JInterFrameQuanLyPhong() {
        initComponents();
        this.setResizable(false);
       InitColumTable();
    }
/**
 *Ham Khoi Tao Cac Gia Tri Cho Combobox
 */
    private void Init()
    {
//        try
//        {
//            DefaultComboBoxModel dfcbxTheLoai=new DefaultComboBoxModel();
//            DefaultComboBoxModel dfcbxNhaXB=new DefaultComboBoxModel();
//
//            dstheloai=theloaidao.layDanhSach_TheLoai();
//
//            for(TheLoaiPOJO i: dstheloai)
//            {
//                Vector vt=new Vector();
//                vt.add(i.getMaTheLoai());
//                vt.add(i.getTenTheLoai());
//                //them mot dong voao model
//                dfcbxTheLoai.addElement(vt);
//            }
//            this.jcmbTheLoai.setModel(dfcbxTheLoai);
//
//            //
//            dsnxb=nhaxbdao.layDSNhaXuatBan();
//
//            for(NhaXuatBanPOJO i:dsnxb)
//            {
//                Vector vt=new  Vector();
//                vt.add(i.getMaNhaXuatBan());
//                vt.add(i.getTenNhaXuatBan());
//                dfcbxNhaXB.addElement(vt);
//            }
//            this.jcmbxNhaXuatBan.setModel(dfcbxNhaXB);
//
//
//        }
//        catch(Exception ex)
//        {
//            JOptionPane.showMessageDialog(this, ex.getMessage(),"Đã xảy ra lỗi",JOptionPane.ERROR_MESSAGE);
//        }
    }
/**
 * Ham Xoa Cac Dong Trong table ( quan trong lam do)
 * Muc dich: trong table co nhieu dong trong do,muon khoi tao lai cac gia tri table moi hoan toan
 * thi phai su dung ham nay de xoa tat ca cac dong hien co trong table
 */
public void ClearTableDSSach()
{

    javax.swing.table.DefaultTableModel mode=(DefaultTableModel) this.jtblDSSach.getModel();
   
    for (int i=jtblDSSach.getRowCount()-1;i>=0;i--)
    {
         mode.removeRow(i);
//
    }
}


 private void HienThiDanhSachSach()
{
//    dssach=sachdao.layDanhSachCacMaSach();
//   ClearTableDSSach() ;
//   // InitColumTable();
//   // jtblDSSach.removeAll();
//    // DefaultTableModel mode=new DefaultTableModel();
//
//    javax.swing.table.DefaultTableModel model=(DefaultTableModel) this.jtblDSSach.getModel();
//    stt=1;
//     for(SachPOJO i : dssach )
//     {
//         Vector vt=new Vector();
//         vt.add(stt);
//         vt.add(i.getMaSach());
//         vt.add(i.getTenSach());
//         vt.add(i.getGiaBan());
//         vt.add(i.getSoLuongTon());
//         model.addRow(vt);
//         stt++;
//     }
   // this.jtblDSSach.setModel(dftablemodel);
}
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jpnThongTinQuanLySach = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jtxtTenSach = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jcmbxNhaXuatBan = new javax.swing.JComboBox();
        jtxtSoLuongTon = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jtxtMaSach = new javax.swing.JTextField();
        jbtnSuaSach = new javax.swing.JButton();
        jbtnThemSach = new javax.swing.JButton();
        jbtnXoaSach = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtblDSSach = new javax.swing.JTable();

        setClosable(true);
        setIconifiable(true);
        setResizable(true);
        setTitle("Quản lý phòng");
        setDoubleBuffered(true);
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameOpened(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255, 204, 204));

        jPanel2.setBackground(new java.awt.Color(204, 204, 255));

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        jLabel8.setText("QUẢN LÝ PHÒNG CHIẾU ");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(240, 240, 240)
                .addComponent(jLabel8)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel8)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jpnThongTinQuanLySach.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 255), 2), "Thông tin phòng"));

        jLabel3.setText("Số lượng ghế");

        jLabel1.setText("Rạp chiếu");

        jLabel4.setText("Tình trạng phòng");

        jLabel7.setText("Tên phòng");

        jbtnSuaSach.setText("Sửa");
        jbtnSuaSach.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnSuaSachActionPerformed(evt);
            }
        });

        jbtnThemSach.setText("Thêm");
        jbtnThemSach.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnThemSachActionPerformed(evt);
            }
        });

        jbtnXoaSach.setText("Xóa");
        jbtnXoaSach.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnXoaSachActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(35, 35, 35)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel7)
                            .addComponent(jLabel1)
                            .addComponent(jLabel4))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jtxtSoLuongTon, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jtxtTenSach)
                            .addComponent(jtxtMaSach)
                            .addComponent(jcmbxNhaXuatBan, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(jbtnThemSach, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                        .addComponent(jbtnXoaSach, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jbtnSuaSach, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jcmbxNhaXuatBan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtMaSach, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGap(12, 12, 12)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3)
                    .addComponent(jtxtTenSach, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jtxtSoLuongTon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(38, 38, 38)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
                    .addComponent(jbtnXoaSach, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jbtnSuaSach, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jbtnThemSach, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(84, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jpnThongTinQuanLySachLayout = new javax.swing.GroupLayout(jpnThongTinQuanLySach);
        jpnThongTinQuanLySach.setLayout(jpnThongTinQuanLySachLayout);
        jpnThongTinQuanLySachLayout.setHorizontalGroup(
            jpnThongTinQuanLySachLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnThongTinQuanLySachLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jpnThongTinQuanLySachLayout.setVerticalGroup(
            jpnThongTinQuanLySachLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnThongTinQuanLySachLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(51, 51, 255), 2), "Danh sách phòng"));

        jtblDSSach.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jtblDSSach.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtblDSSachMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jtblDSSach);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 515, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jpnThongTinQuanLySach, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jpnThongTinQuanLySach, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents
/**
 * Ham formInternalFrameOpened giong nhu su kiem form load 
 * @param evt
 */
    private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
        // TODO add your handling code here:
        try
        {

             Init();
             HienThiDanhSachSach();
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(this, ex.getMessage(),"Đã xảy ra lỗi",JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_formInternalFrameOpened

    private void jbtnThemSachActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnThemSachActionPerformed
        // TODO add your handling code here:
//        try{
//            Vector vtnxb=(Vector) this.jcmbxNhaXuatBan.getSelectedItem();
//            Vector vttheloai=(Vector) this.jcmbTheLoai.getSelectedItem();
//            int matheloai=(Integer)vttheloai.get(0);
//            String manbx=(String) vtnxb.get(0);
//
//            SachPOJO sachdto=new SachPOJO();
//
//            sachdto.setMaNhaXuatBan(manbx);
//            sachdto.setMaTheLoai(matheloai);
//            sachdto.setMaSach(this.jtxtMaSach.getText());
//            sachdto.setTenSach(this.jtxtTenSach.getText());
//            sachdto.setSoLuongTon(Integer.parseInt(this.jtxtSoLuongTon.getText()));
//            sachdto.setGiaBan(Float.parseFloat(this.jtxtGiaBan.getText()));
//
//            if(sachdao.themSach(sachdto)==true)
//            {
//               Vector vt=new Vector();
//               vt.add(stt++);
//               vt.add(sachdto.getMaSach());
//               vt.add(sachdto.getTenSach());
//               vt.add(sachdto.getSoLuongTon());
//               vt.add(sachdto.getGiaBan());
//               this.dftablemodel.addRow(vt);
//            }
//
//        }catch(Exception ex)
//        {
//             JOptionPane.showMessageDialog(this, ex.getMessage(),"Đã xảy ra lỗi",JOptionPane.ERROR_MESSAGE);
//        }
    }//GEN-LAST:event_jbtnThemSachActionPerformed
/**
 * Ham jtblDSSachMouseClicked : Lay dong duoc chon trong table
 * va lay ra tung thuoc tinh cua dong trng table va hien thi len cac textbox
 * @param evt
 */
    private void jtblDSSachMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtblDSSachMouseClicked
        // TODO add your handling code here:
//        try{
//            int vt=this.jtblDSSach.getSelectedRow();
//            String masach= (String) this.jtblDSSach.getValueAt(vt,1);
//            String tensach=(String) this.jtblDSSach.getValueAt(vt, 2);
//           // float giaban=Float.parseFloat(this.jtblDSSach.getValueAt(vt, 3).toString().trim());
//           // int soluongton=(Integer)this.jtblDSSach.getValueAt(vt, 4);
//            this.jtxtMaSach.setText(masach);
//            this.jtxtTenSach.setText(tensach);
//            this.jtxtSoLuongTon.setText(this.jtblDSSach.getValueAt(vt, 4).toString());
//            //this.jtxtGiaBan.setText(this.jtblDSSach.getValueAt(vt, 3).toString().trim());
//           
//        }catch(Exception ex)
//        {
//              JOptionPane.showMessageDialog(this, ex.getMessage(),"Đã xảy ra lỗi",JOptionPane.ERROR_MESSAGE);
//        }
    }//GEN-LAST:event_jtblDSSachMouseClicked
/**
 * Ham jbtnXoaSachActionPerformed xoa Sach theo ma sach
 * @param evt
 */
    private void jbtnXoaSachActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnXoaSachActionPerformed
        // TODO add your handling code here:
//        try
//        {
//           String masach= this.jtxtMaSach.getText();
//           if(sachdao.xoaSach(masach))
//           {
//                JOptionPane.showMessageDialog(this,"Xóa sách thành công", "Thống báo",JOptionPane.DEFAULT_OPTION);
//                HienThiDanhSachSach();
//                this.jtxtMaSach.setText("");
//                this.jtxtTenSach.setText("");
//                this.jtxtGiaBan.setText("");
//                this.jtxtSoLuongTon.setText("");
//           }
//        }catch(Exception ex)
//        {
//              JOptionPane.showMessageDialog(this, ex.getMessage(),"Đã xảy ra lỗi",JOptionPane.ERROR_MESSAGE);
//        }
    }//GEN-LAST:event_jbtnXoaSachActionPerformed

    private void jbtnSuaSachActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnSuaSachActionPerformed
        // TODO add your handling code here:
//        try
//        {
//            Vector vtnxb=(Vector) this.jcmbxNhaXuatBan.getSelectedItem();
//            Vector vttheloai=(Vector) this.jcmbTheLoai.getSelectedItem();
//            int matheloai=(Integer)vttheloai.get(0);
//            String manbx=(String) vtnxb.get(0);
//
//             SachPOJO sachdto=new SachPOJO();
//
//            sachdto.setMaNhaXuatBan(manbx);
//            sachdto.setMaTheLoai(matheloai);
//            sachdto.setMaSach(this.jtxtMaSach.getText());
//            sachdto.setTenSach(this.jtxtTenSach.getText());
//            sachdto.setSoLuongTon(Integer.parseInt(this.jtxtSoLuongTon.getText()));
//            sachdto.setGiaBan(Float.parseFloat(this.jtxtGiaBan.getText()));
//
//            if(sachdao.capNhatSach(sachdto))
//            {
//                JOptionPane.showMessageDialog(this,"Cập nhật thành công", "Thống báo",JOptionPane.DEFAULT_OPTION);
//                HienThiDanhSachSach();
//            }
//
//        }catch(Exception ex)
//        {
//         JOptionPane.showMessageDialog(this, ex.getMessage(),"Đã xảy ra lỗi",JOptionPane.ERROR_MESSAGE);
//        }
    }//GEN-LAST:event_jbtnSuaSachActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtnSuaSach;
    private javax.swing.JButton jbtnThemSach;
    private javax.swing.JButton jbtnXoaSach;
    private javax.swing.JComboBox jcmbxNhaXuatBan;
    private javax.swing.JPanel jpnThongTinQuanLySach;
    private javax.swing.JTable jtblDSSach;
    private javax.swing.JTextField jtxtMaSach;
    private javax.swing.JTextField jtxtSoLuongTon;
    private javax.swing.JTextField jtxtTenSach;
    // End of variables declaration//GEN-END:variables

}
